﻿Public Class PhongDAO
    Public Shared Function SelectAll() As DataTable
        Dim strSQL As String = "select * from PhongHoc"
        Dim dt As DataTable
        dt = SQLProvider.ExecQuery(strSQL)
        Return dt
    End Function
    Public Shared Sub Insert(ByVal _phong As PhongDTO)
        Dim strSQL As String = "Insert into PhongHoc(Sohieuphong,Loaiphong,Succhua,Thietbi)  Values('" & _phong.Sohieuphong & "',N'" & _phong.Loaiphong & "'," & _phong.Succhua & ",N'" & _phong.Thietbi & "')"
        SQLProvider.ExecNoneQuery(strSQL)

    End Sub
    Public Shared Sub Delete(ByVal _phong As PhongDTO)
        Dim strSQL As String = "delete from PhongHoc where Sohieuphong = '" & _phong.Sohieuphong & "'"
        SQLProvider.ExecNoneQuery(strSQL)
    End Sub
    Public Shared Sub Update(ByVal _phong As PhongDTO)
        Dim strSQL As String = "Update PhongHoc set LoaiPhong = N'" & _phong.Loaiphong & "', Succhua = " & _phong.Succhua & ", Thietbi = N'" & _phong.Thietbi & "' where Sohieuphong = '" & _phong.Sohieuphong & "'"
        SQLProvider.ExecNoneQuery(strSQL)
    End Sub
    Public Shared Function SelectByPhong(ByVal _phong As PhongDTO) As DataTable
        Dim dt As DataTable
        Dim strSQL As String = "select * from PhongHoc where Loaiphong like N'%" & _phong.Loaiphong & "%'"
        dt = SQLProvider.ExecQuery(strSQL)
        Return dt
    End Function
End Class
